package com.android.happymall.view.recycleview.decoration;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by clevo on 2015/7/27.
 */
public class Fragment_DirectBuy_TabListItemDecoration extends RecyclerView.ItemDecoration {

    private int space;
    /**
     * 1.左中右都相等上下相等  空隙总数 spanSize+1
     * 2.左右没有空隙中间有 中上下相等  空隙总数spanSize-1
     */
    private int type = 1;
    private int spanSize = 1;
    int left, right, top, bottom;

    public Fragment_DirectBuy_TabListItemDecoration(int space) {
        this.space = space;
    }


    /**
     * @param left
     * @param right
     * @param top
     * @param bottom
     */
    public Fragment_DirectBuy_TabListItemDecoration(int left, int right, int top, int bottom) {
        this.left = left;
        this.right = right;
        this.top = top;
        this.bottom = bottom;
    }


    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {

        int position = parent.getChildAdapterPosition(view);

        if (position == 0 || position == 1) {
            outRect.top=space;

        }
    }
}
